package com.JohnCarloSalter.Receipt;

public class PurchaseItem {
	String name;
	String description;
	int itemCode;
	int quantity;
	double price;
	
	public PurchaseItem(String n, String desc, int code, int q, double p) {
		name = n;
		description = desc;
		itemCode = code;
		quantity = q;
		price = p;
	}
	
	public void print() {
		System.out.printf("%s(x%d)%15.2f\n", name, quantity, price);
	}
	
	public String toString() {
		return String.format("%-27s%s%24s%.2f", name, "(x" + quantity + ")", "$", price);
	}	
	
	//Needed getters.
	public double getPrice() {
		return price * quantity;
	}
}
